package com.punai.dataanalysis.cblib.bo;

import cn.hutool.core.collection.CollUtil;
import com.punai.common.utils.bean.BeanUtils;
import com.punai.externalccb.mysqlbo.EcoCbfeeitemPriceBo;
import com.punai.standard.domain.StaFbFee;
import com.punai.standard.domain.StaGxFee;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class StaFbFeeBo extends StaFbFee {

    private Integer feeAmount;

    private BigDecimal avgPrice;

    private String originalCode;

    private List<StaFbFeeBo> children = new ArrayList<>();

    public Integer getFeeAmount() {
        return feeAmount;
    }

    public void setFeeAmount(Integer feeAmount) {
        this.feeAmount = feeAmount;
    }

    public BigDecimal getAvgPrice() {
        return avgPrice;
    }

    public void setAvgPrice(BigDecimal avgPrice) {
        this.avgPrice = avgPrice;
    }

    public List<StaFbFeeBo> getChildren() {
        return children;
    }

    public void setChildren(List<StaFbFeeBo> children) {
        this.children = children;
    }

    public String getOriginalCode() {
        return originalCode;
    }

    public void setOriginalCode(String originalCode) {
        this.originalCode = originalCode;
    }

    public static StaFbFeeBo convert(StaFbFee in) {
        StaFbFeeBo out = new StaFbFeeBo();
        BeanUtils.copyBeanProp(out,in);
        return out;
    }

    public static List<StaFbFeeBo> convert(List<EcoCbfeeitemPriceBo> cbfeeitemPriceBos) {
        List<StaFbFeeBo> result = new ArrayList<>();
        if (CollUtil.isNotEmpty(cbfeeitemPriceBos)) {
            for (EcoCbfeeitemPriceBo cbfeeitemPriceBo : cbfeeitemPriceBos) {
                result.add(convert(cbfeeitemPriceBo));
            }
        }
        return result;
    }


    public static StaFbFeeBo convert(EcoCbfeeitemPriceBo in) {
        StaFbFeeBo gxFeeBo = new StaFbFeeBo();
        gxFeeBo.setId(in.getId());
        gxFeeBo.setCode("");
        gxFeeBo.setName(in.getName());
        gxFeeBo.setUnit(in.getUnit());
        gxFeeBo.setOriginalCode(in.getOrgincode());
        gxFeeBo.setFeeAmount(in.getFeeAmount());
        gxFeeBo.setAvgPrice(in.getAvgPrice());
        return gxFeeBo;
    }


}
